package com.sgb.kjwl.view.ui.adapter.home;

import android.content.Context;
import android.widget.TextView;

import com.sgb.kjwl.BR;
import com.sgb.kjwl.R;
import com.swgk.core.view.entity.MenuEntity;
import com.swgk.core.recyclerview.adapter.BaseRecycleAdapter;
import com.swgk.core.recyclerview.adapter.ItemViewHolder;

import java.util.List;

public class BigMaterialChildAdapter extends BaseRecycleAdapter<MenuEntity> {
    private TextView tv;


    public BigMaterialChildAdapter(Context context, List<MenuEntity> datas) {
        super(context, R.layout.item_big_tv, datas);
    }

    @Override
    public void convert(ItemViewHolder holder, final MenuEntity entity) {
        holder.setBinding(BR.viewModel, entity);
        tv = holder.getItem().findViewById(R.id.tv);
        if (entity.getName().length() > 4) {
            tv.setText(entity.getName().substring(0, 4) + "...");
        } else {
            tv.setText(entity.getName());
        }
    }
}
